namespace VAdvantage.Model
{

    /** Generated Model - DO NOT CHANGE */
    using System;
    using System.Text;
    using VAdvantage.DataBase;
    using VAdvantage.Common;
    using VAdvantage.Classes;
    using VAdvantage.Process; using VAdvantage.ProcessEngine;
    using VAdvantage.Model;
    using VAdvantage.Utility;
    using System.Data;
    /** Generated Model for AD_Note
     *  @author Jagmohan Bhatt (generated) 
     *  @version Vienna Framework 1.1.1 - $Id$ */
    public class X_AD_Note : PO
    {
        public X_AD_Note(Context ctx, int AD_Note_ID, String trxName)
            : base(ctx, AD_Note_ID, trxName)
        {
            /** if (AD_Note_ID == 0)
            {
            SetAD_Message_ID (0);
            SetAD_Note_ID (0);
            }
             */
        }
        public X_AD_Note(Ctx ctx, int AD_Note_ID, String trxName)
            : base(ctx, AD_Note_ID, trxName)
        {
            /** if (AD_Note_ID == 0)
            {
            SetAD_Message_ID (0);
            SetAD_Note_ID (0);
            }
             */
        }
        /** Load Constructor 
        @param ctx context
        @param rs result set 
        @param trxName transaction
        */
        public X_AD_Note(Context ctx, DataRow rs, String trxName)
            : base(ctx, rs, trxName)
        {
        }
        /** Load Constructor 
        @param ctx context
        @param rs result set 
        @param trxName transaction
        */
        public X_AD_Note(Ctx ctx, DataRow rs, String trxName)
            : base(ctx, rs, trxName)
        {
        }
        /** Load Constructor 
        @param ctx context
        @param rs result set 
        @param trxName transaction
        */
        public X_AD_Note(Ctx ctx, IDataReader dr, String trxName)
            : base(ctx, dr, trxName)
        {
        }
        /** Serial Version No */
        static long serialVersionUID = 27542468341316L;
        /** Last Updated Timestamp 12/9/2009 12:47:04 PM */
        public static long updatedMS = 1260343024527L;
        /** AD_Table_ID=389 */
        public static int Table_ID = 389;

        /** TableName=AD_Note */
        public static String Table_Name = "AD_Note";

        protected static KeyNamePair model = new KeyNamePair(389, "AD_Note");

        protected Decimal accessLevel = new Decimal(7);
        /** AccessLevel
        @return 7 - System - Client - Org 
        */
        protected override int Get_AccessLevel()
        {
            return Convert.ToInt32(accessLevel.ToString());
        }
        /** Load Meta Data
        @param ctx context
        @return PO Info
        */
        protected override POInfo InitPO(Context ctx)
        {
            POInfo poi = POInfo.GetPOInfo(ctx, Table_ID);
            return poi;
        }
        /** Load Meta Data
        @param ctx context
        @return PO Info
        */
        protected override POInfo InitPO(Ctx ctx)
        {
            POInfo poi = POInfo.GetPOInfo(ctx, Table_ID);
            return poi;
        }
        /** Info
        @return info
        */
        public override String ToString()
        {
            StringBuilder sb = new StringBuilder("X_AD_Note[").Append(Get_ID()).Append("]");
            return sb.ToString();
        }

        /** AD_Message_ID AD_Reference_ID=102 */
        public static int AD_MESSAGE_ID_AD_Reference_ID = 102;
        /** Set Message.
        @param AD_Message_ID System Message */
        public void SetAD_Message_ID(int AD_Message_ID)
        {
            if (AD_Message_ID < 1)
            {
                throw new ArgumentException("AD_Message_ID is mandatory.");
            }
            try
            {
                Set_ValueNoCheck("AD_Message_ID", AD_Message_ID);
            }
            catch { }
        }
        /** Get Message.
        @return System Message */
        public int GetAD_Message_ID()
        {
            Object ii = Get_Value("AD_Message_ID");
            if (ii == null)
                return 0;
            return Convert.ToInt32(ii);
        }
        /** Get Record ID/ColumnName
        @return ID/ColumnName pair */
        public KeyNamePair GetKeyNamePair()
        {
            return new KeyNamePair(Get_ID(), GetAD_Message_ID().ToString());
        }
        /** Set Notice.
        @param AD_Note_ID System Notice */
        public void SetAD_Note_ID(int AD_Note_ID)
        {
            if (AD_Note_ID < 1)
                throw new ArgumentException("AD_Note_ID is mandatory.");
            Set_ValueNoCheck("AD_Note_ID", AD_Note_ID);
        }
        /** Get Notice.
        @return System Notice */
        public int GetAD_Note_ID()
        {
            Object ii = Get_Value("AD_Note_ID");
            if (ii == null)
                return 0;
            return Convert.ToInt32(ii);
        }
        /** Set Table.
        @param AD_Table_ID Database Table information */
        public void SetAD_Table_ID(int AD_Table_ID)
        {
            if (AD_Table_ID <= 0)
                Set_ValueNoCheck("AD_Table_ID", null);
            else
                Set_ValueNoCheck("AD_Table_ID", AD_Table_ID);
        }
        /** Get Table.
        @return Database Table information */
        public int GetAD_Table_ID()
        {
            Object ii = Get_Value("AD_Table_ID");
            if (ii == null)
                return 0;
            return Convert.ToInt32(ii);
        }
        /** Set User/Contact.
        @param AD_User_ID User within the system - Internal or Business Partner Contact */
        public void SetAD_User_ID(int AD_User_ID)
        {
            if (AD_User_ID <= 0)
                Set_Value("AD_User_ID", null);
            else
                Set_Value("AD_User_ID", AD_User_ID);
        }
        /** Get User/Contact.
        @return User within the system - Internal or Business Partner Contact */
        public int GetAD_User_ID()
        {
            Object ii = Get_Value("AD_User_ID");
            if (ii == null)
                return 0;
            return Convert.ToInt32(ii);
        }
        /** Set Workflow Activity.
        @param AD_WF_Activity_ID Workflow Activity */
        public void SetAD_WF_Activity_ID(int AD_WF_Activity_ID)
        {
            if (AD_WF_Activity_ID <= 0)
                Set_Value("AD_WF_Activity_ID", null);
            else
                Set_Value("AD_WF_Activity_ID", AD_WF_Activity_ID);
        }
        /** Get Workflow Activity.
        @return Workflow Activity */
        public int GetAD_WF_Activity_ID()
        {
            Object ii = Get_Value("AD_WF_Activity_ID");
            if (ii == null)
                return 0;
            return Convert.ToInt32(ii);
        }
        /** Set Description.
        @param Description Optional short description of the record */
        public void SetDescription(String Description)
        {
            if (Description != null && Description.Length > 255)
            {
                log.Warning("Length > 255 - truncated");
                Description = Description.Substring(0, 255);
            }
            Set_Value("Description", Description);
        }
        /** Get Description.
        @return Optional short description of the record */
        public String GetDescription()
        {
            return (String)Get_Value("Description");
        }
        /** Set Processed.
        @param Processed The document has been processed */
        public void SetProcessed(Boolean Processed)
        {
            Set_Value("Processed", Processed);
        }
        /** Get Processed.
        @return The document has been processed */
        public Boolean IsProcessed()
        {
            Object oo = Get_Value("Processed");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool))
                    return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set Process Now.
        @param Processing Process Now */
        public void SetProcessing(Boolean Processing)
        {
            Set_Value("Processing", Processing);
        }
        /** Get Process Now.
        @return Process Now */
        public Boolean IsProcessing()
        {
            Object oo = Get_Value("Processing");
            if (oo != null)
            {
                if (oo.GetType() == typeof(bool))
                    return Convert.ToBoolean(oo);
                return "Y".Equals(oo);
            }
            return false;
        }
        /** Set Record ID.
        @param Record_ID Direct internal record ID */
        public void SetRecord_ID(int Record_ID)
        {
            if (Record_ID <= 0)
                Set_ValueNoCheck("Record_ID", null);
            else
                Set_ValueNoCheck("Record_ID", Record_ID);
        }
        /** Get Record ID.
        @return Direct internal record ID */
        public int GetRecord_ID()
        {
            Object ii = Get_Value("Record_ID");
            if (ii == null)
                return 0;
            return Convert.ToInt32(ii);
        }
        /** Set Reference.
        @param Reference Reference for this record */
        public void SetReference(String Reference)
        {
            if (Reference != null && Reference.Length > 60)
            {
                log.Warning("Length > 60 - truncated");
                Reference = Reference.Substring(0, 60);
            }
            Set_Value("Reference", Reference);
        }
        /** Get Reference.
        @return Reference for this record */
        public String GetReference()
        {
            return (String)Get_Value("Reference");
        }
        /** Set Text Message.
        @param TextMsg Text Message */
        public void SetTextMsg(String TextMsg)
        {
            if (TextMsg != null && TextMsg.Length > 2000)
            {
                log.Warning("Length > 2000 - truncated");
                TextMsg = TextMsg.Substring(0, 2000);
            }
            Set_Value("TextMsg", TextMsg);
        }
        /** Get Text Message.
        @return Text Message */
        public String GetTextMsg()
        {
            return (String)Get_Value("TextMsg");
        }
    }

}
